package com.jfinal_demo.app.validators;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;
import com.jfinal_demo.app.DataWrapper;

public class UserInfoValidator extends Validator {
    @Override
    protected void validate(Controller controller) {
        validateRequiredString("userName", "userName", "UserName is required");
        validateRequiredString("password", "password", "Password is required");
    }

    @Override
    protected void handleError(Controller controller) {
        controller.renderJson(DataWrapper.fail("400"));
    }
}
